<?php

/** Отображает сверху панель навигации, с кнопками в личный кабинет, выход, игровой форум и т.д. и т.п. */
abstract class AuthView extends RegularView
{
	private $oModel;
	
	public function __construct(AuthModel $model) 
	{ 
		parent::__construct();
		$this->oModel = $model;

		if ($this->model()->isAdmin())
			$this->addCss("adm");
	}
	
	protected function model() { return $this->oModel; }
	
	protected function body()
	{
	?>
	<div><a href = "<?php $this->url(array("action" => "logout")); ?>"><?php TextManager::i()->text("LOGOUT"); ?></a></div>
	<?php
		if ($this->model()->isAdmin())
			$this->adminPanel();
		
		if ($this->model()->isPlayer())
			$this->playerPanel();
		
		$this->content();
	}
	
	private function playerPanel()
	{
	?>
	<div id = "top_panel">
		<a href = "<?php $this->url(array("view" => "city")); ?>"><?php TextManager::i()->text("TO_GAME"); ?></a>
	</div>
	<?php
	}
	
	private function adminPanel()
	{
	?>
	<div id = "admin_panel">
		<a href = "<?php $this->url(array("view" => "admin")); ?>"><?php TextManager::i()->text("PLAYERS_EDIT"); ?></a>
		<br />
		<a href = "<?php $this->url(array("view" => "items_edit")); ?>"><?php TextManager::i()->text("ITEMS_EDIT"); ?></a>
	</div>
	<?php
	}
	
	abstract protected function content();
}

?>